package com.bt.util;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;

import java.io.IOException;

/**
 * @author wbt
 * @version v1.0
 * @project shop_manage
 * @data 2022/9/24 10:01
 **/
public class JsonStringArray2Deserializer extends JsonDeserializer {
    @Override
    public Object deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
        String json = jsonParser.getCurrentName();
        if (json.length() == 0) {
            return null;
        }
        return json.split(",");

    }
}
